#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int ad[1000];
	int as[1000];
	int az[1000];
	int n, m, sum;
	scanf("%d",&n);
	int i, j;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &ad[i]);
	}
	scanf("%d", &m);
	for (j = 0; j < m; j++)
	{
		scanf("%d", &as[j]);
	}
	sum = n + m;
	int k;
	for (k = 0; k < n; k++)
	{
		az[k] = ad[k];
	}
	int s;
	for (s = 0 ; s < m; s++)
	{
		az[s+n] = as[s];
	}
	int o,y;
	int temp;
	for (o = 0; o < sum-1; o++)
	{
		for (y = 0; y < sum - 1 - o; y++)
		{
			if (az[y] > az[y + 1])
			{
				temp = az[y + 1];
				az[y + 1] = az[y];
				az[y] = temp;
			}
		}
	}
	int x;
	for (x = 0; x < sum; x++)
	{
		printf("%d ", az[x]);
	}

	return 0;
}